package testUnit.scoreUnitTest;

import java.util.ArrayList;
import java.util.List;

import org.junit.jupiter.api.Test;

import com.situ.staff.employee.model.EmployeeModel;
import com.situ.staff.score.dao.ScoreDao;
import com.situ.staff.score.model.ScoreModel;

public class scoreTestUnit {
	ScoreDao dao = new ScoreDao();

	@Test
	public void testInsert() {
		ScoreModel model = new ScoreModel("e03", "006", "92");
		try {
			dao.insert(model);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("插入完成");
	}

	@Test
	public void testdeleteById() {
		ScoreModel model = new ScoreModel(1, "e03", "006", "92");
		try {
			dao.deleteById(model);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("删除完成");
	}

	@Test
	public void testdeleteByCode() {
		ScoreModel model = new ScoreModel("e03", "006", "92");
		try {
			dao.deleteByCode(model);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("删除完成");
	}

	@Test
	public void testdelete() {
		ScoreModel model = new ScoreModel("e03", null, null);
		try {
			dao.delete(model);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("删除完成");
	}

	@Test
	public void testupdateAllById() {
		ScoreModel model = new ScoreModel(2, "e06", "008", "97");
		try {
			dao.updateAllById(model);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println("更新完成");
	}

	@Test
	public void testupdateAll() {
		ScoreModel model = new ScoreModel("e01", "006", "101");
		try {
			dao.updateAll(model);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println("更新完成");
	}

	@Test
	public void testupdateActiveById() {
		ScoreModel model = new ScoreModel(2, "e09", "009", "98");
		try {
			dao.updateActiveById(model);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println("更新完成");
	}
	
	@Test
	public void testupdateActive() {
		ScoreModel model = new ScoreModel(2, "e09", "009", "100");
		try {
			dao.updateActive(model);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println("更新完成");
	}
	
	@Test
	public void testselectList() {
		ScoreModel model = new ScoreModel("e01", null,null);
		List<ScoreModel> list = new ArrayList<ScoreModel>();

		try {
			list = dao.selectList(model);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println(list.size());
	}
	
	@Test
	public void testselectModel() {
		ScoreModel model = new ScoreModel("e01", null,null);
//		List<ScoreModel> list = new ArrayList<ScoreModel>();
		ScoreModel s1 = new ScoreModel();
		try {
			s1=  dao.selectModel(model);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println(s1.toString());
	}

}
